//
//  Filters.m
//  GiftSay
//
//  Created by QQn1993 on 16/1/11.
//  Copyright © 2016年 liyinkai. All rights reserved.
//

#import "Filters.h"
#import "Channel.h"

@implementation Filters

- (instancetype)initWithDasource:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        self.Id = [NSString stringWithFormat:@"%@",value];
    }
    
    if ([key isEqualToString:@"channels"]) {
        NSMutableArray *temp = [NSMutableArray arrayWithCapacity:0];
        NSArray *array = [NSArray arrayWithArray:value];
        for (NSDictionary *dic in array) {
            Channel *channel = [[Channel alloc] initWithDatasource:dic];
            [temp addObject:channel];
        }
        
        self.channel = [NSArray arrayWithArray:temp];
        
    }
    
}

- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}

@end
